<template>
	<view class="w100 h100">
		<view  class="w100 h100">
			<view class="card c3 mb10 cshow" v-for="(form,index) in orderList" :key="index" @click="toDtail(form)">
				<view class="bd1 dfa pb10">
					<view class="f-c-s f-1">
						<view class="c0 dfa">
							<text v-if="form.diningType==6">#<text class="f24 wei6">{{form.pickNo}}</text></text>
							<text v-else>#<text class="f24 wei6" v-if="form.table">{{form.table.type.name}}{{form.table.name}}</text></text>
							<text class="ml5 f10 bs4" :style="{padding: '8rpx',background: subColor,color: '#000'}"
								v-if="form.packaging==1">打包</text>
						</view>
						<!-- <view class="f12 c6 mt5" v-if="form.diningType==4">桌台:{{form.table.area.name}}-{{form.table.type.name}}-{{form.table.name}} 人数：{{form.people}}人</view> -->
						<view class="c6 f10 mt5">{{form.packagingFormat}} / {{form.created_at}}
							<text v-if="form.diningType==4"><text class="mlr5">/</text>就餐:{{form.people}}人</text>
						</view>
					</view>
					<view class="f-c-e wei6">
						<view>
							<text class="pr5 c0">{{form.stateFormat}}</text>
							<!-- <text class="pl5" :style="{color:subColor}">{{form.diningTypeFormat}}</text> -->
						</view>
						<text class="f10 p5 c9 bf8 mt5">{{form.orderIndex && form.orderIndex.payStateFormat}}</text>
					</view>
				</view>
				<view class="flex bz mt10 bs4 f-y-t" v-if="form.notes">
					<view class="left f10 bs4 mr5 f-g-0">备注</view>
					<view class="f14 wei">{{ form.notes}}</view>
				</view>
				<view class="f-bt mt10">
					<view class="wei f16 c0">{{form.goods && form.goods.length}}种商品，共{{form.goodsNum}}件</view>
					<view>
						<view>
							<text>总计</text>
							<text class="wei f14">￥{{form.money}}</text>
						</view>
					</view>
				</view>
				<view class="f-x-e mt10 pt10 bt1" v-if="form.state>0 && form.state<=5">
					<view  v-if="form.addFood  && form.table" class="f-g-0 w50 p-0-10" @click.stop="$emit('op','addOrder',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}" text="继续加菜"
							:color="subColor" shape="circle">
						</u-button>
					</view>
					<!-- <view v-if="form.state == 3 && form.diningType==4 && form.payType==2" class="f-g-0 w50 p-0-10" @click.stop="$emit('op','checkout',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}" text="结账并清台"
							:color="subColor" shape="circle">
						</u-button>
					</view> -->
					<view v-if="form.state == 3 && form.diningType==4 && form.payType==1" class="f-g-0 w50 p-0-10" @click.stop="$emit('op','cltable',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}" text="完成并清台"
							:color="subColor" shape="circle">
						</u-button>
					</view>
					<view v-if="form.diningType != 4 && form.state == 4" class="f-g-0 w50 p-0-10"
						@click.stop="$emit('op','completeOrder',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}" :plain="true"
							text="完成订单" color="#e4e4e4" shape="circle">
						</u-button>
					</view>
					<view v-if="form.diningType != 4 && form.state == 4 && form.takeScreen && form.takeScreen.id" class="f-g-0 w50 p-0-10"
						@click.stop="$emit('op','call',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}"
							text="叫号" :color="subColor" shape="circle">
						</u-button>
					</view>
					<view v-if="form.diningType != 4 && form.state==3" class="f-g-0 w50 p-0-10" @click.stop="$emit('op','maked',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}" text="制作完成"
							:color="subColor" shape="circle">
						</u-button>
					</view>
					<view v-if="form.state==2" class="f-g-0 w50 p-0-10" @click.stop="$emit('op','refusal',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}" :plain="true"
							text="拒单" color="#e4e4e4" shape="circle">
						</u-button>
					</view>
					<view v-if="form.state==2" class="f-g-0 w50 p-0-10" @click.stop="$emit('op','receiving',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}" text="接单"
							:color="subColor" shape="circle">
						</u-button>
					</view>
				</view>
				<!-- <view class="dfa mt10">
					<u-avatar :src="form.user.img" shape="square"></u-avatar>
					<view class="f-e-c ml10">
						<text class="c3" v-if="form.user">{{form.user.nickname}}</text>
						<text v-else>操作人：{{form.admin && form.admin.nickname}}</text>
						<text class="f10 c9 mt5">{{form.created_at}}</text>
					</view>
				</view> -->
				<!-- <view class="mt5 dfbc mb15" style="padding-left: 90rpx;" v-if="form.goods">
					<view class="">
						<text class="mr5">{{form.goods[0].name}}</text>等<text>{{form.goods.length}}</text>件商品
					</view>
					<text>{{form.money}}元</text>
				</view> -->
			</view>
		</view>
		<!-- <view v-else class="w100 h100">
			<view class="card c3 mb10" v-for="(form,index) in orderList" :key="index" @click="toDtail(form)">
				<view class="bd1 dfa pb10">
					<view class="f-c-s f-1">
						<view class="c0 dfa">
							#<text class="f24 wei6">{{form.pickNo}}</text>
						</view>
						<view class="f12 c6 mt5" v-if="form.diningType==4">桌台:{{form.table.area.name}}-{{form.table.type.name}}-{{form.table.name}} 人数：{{form.people}}人</view>
						<view class="f12 c6 mt5" v-else>下单时间:{{form.created_at}}</view>
					</view>
					<view class="f-c-e wei6">
						<view>
							<text class="pr5 c0">{{form.stateFormat}}</text> | <text class="pl5"
								:style="{color:subColor}">{{form.diningTypeFormat}}</text>
						</view>
						<text class="f10 p5 c9 bf8 mt5">{{form.payTypeFormat}}</text>
					</view>
				</view>
				<view class="dfa mt10">
					<u-avatar :src="img" shape="square"></u-avatar>
					<view class="f-e-c ml10">
						<text class="c3">{{form.user.nickname}}</text>
						<text class="f10 c9 mt5">{{form.created_at}}</text>
					</view>
				</view>
				<view class="mt15 bd1">
					<view class="f18 c0">{{form.goods && form.goods.length}}件商品</view>
					<view class="mt5 dfbc mb15" v-for="(v,i) in form.goods" :key="i">
						<view class="">
							<view>
								<text class="mr5">{{v.name}}</text>
							</view>
							<view class="f12 c9">
								<text v-if="v.attrData.spec">{{v.attrData.spec}}</text>
								<text v-if="v.attrData.attr">{{v.attrData.attr}}</text>
								<text v-if="v.attrData.matal">{{v.attrData.matal}}</text>
							</view>
						</view>
						<view class="dfa">
							<text>x{{v.num}}</text>
							<view class="tar ml45">
								<view>￥{{v.money}}</view>
							</view>
						</view>
					</view>
				</view>
				<view class="p-10-0 bd1 f-s-bt" v-if="form.scene==1">
					<view v-if="form.address">
						<view>
							<text class="mr10 f18">{{ form.address.contact }}</text>
							<text class="f14 c0">{{ form.address.mobile }}</text>
						</view>
						<text>{{ form.address.address }}</text>
					</view>
					<text class="ml45 iconfont icon-24gf-telephone" style="font-size: 48rpx;color:#585858"></text>
				</view>
				<view class="p-10-0 dfbc bd1" v-if="form.notes">
					<text>订单备注</text>
					<text>{{ form.notes || '无'}}</text>
				</view>
				<view class="p-10-0 dfbc bd1">
					<text>商家备注</text>
					<view class="dfa">
						<text class="mr10">{{ form.storeNotes || '无'}}</text>
						<view @click.stop="$emit('storeNotes',form)">
							<u-button type="primary" :plain="true" text="编辑" :color="subColor" shape="circle">
							</u-button>
						</view>
					</view>
				</view>
				<view class="tar mt10 mb5">
					<text class="f12" :style="{color:subColor}"
						v-if="form.discountMoney">已优惠￥{{form.discountMoney}}</text>
					<text class="pl10 f14">小计￥</text>
					<text class="f20 c0 wei6">{{form.money}}</text>
				</view>
				<view class="dfbc mt10">
					<view class="f12">
						<view class="mb5" v-if="form.openTime">开台时间：{{form.openTime}}</view>
						<view class="mb5">订单来源：{{form.sourceFormat}}</view>
						<view class="mb5">订单号：{{form.orderIndex.orderSn}}</view>
					</view>
					<view @click.stop="$emit('handPrint',form)">
						<u-button type="primary" :plain="true" text="重新打印" :color="subColor" shape="circle">
						</u-button>
					</view>
				</view>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		props: {
			orderList: {
				type: Array,
				default () {
					return []
				}
			},
			current: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				subColor: uni.getStorageSync('subject_color'),
			}
		},
		methods: {
			toDtail(v) {
				uni.navigateTo({
					url: `/pages/order/indetail?id=${v.orderSn}&type=inStore`
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
</style>